home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir39 / disaster.zip / DISASTER.EXE / README.DOC < prev    next >
Text File  |  1991-10-01  |  18KB  |  432 lines

  1.  
  2.  
  3.  
  4.                         _______
  5.                    ____|__     |               (R)
  6.                 --|       |    |-------------------
  7.                   |   ____|__  |  Association of
  8.                   |  |       |_|  Shareware
  9.                   |__|   o   |    Professionals
  10.                 -----|   |   |---------------------
  11.                      |___|___|    MEMBER
  12.  
  13.  
  14.  
  15.  
  16.  
  17.            ABOUT SHAREWARE
  18.            
  19.                This  package  contains the  disassembler  named DISASTER.
  20.           It is made by
  21.                Feico Nater, 
  22.                Beukweg 24, 
  23.                7556 DE Hengelo,
  24.                the Netherlands.
  25.  
  26.            
  27.                The system is available as shareware.  What  is shareware?
  28.           It is  software which  people pass around,  but I, the  author,
  29.           retain the rights to it.   Maybe you obtained the system from a
  30.           bulletin-board and paid a few  dollars for it, but I  don't get
  31.           a penny  of it.  I expect to be  paid by you, because I make my
  32.           living out of making shareware software.
  33.             Therefore,  if you  like  this system  and  use it,  you  are
  34.           supposed to  register by  sending a  $50-check drawn  on a  US-
  35.           bank.   Sorry,  I  cannot accept  credit-cards.   The  address:
  36.           Feico  Nater Shareware, Beukweg 24,  7556 DE Hengelo, the Neth-
  37.           erlands.
  38.                Why  register?  Well, it costs you  money.  But if you do,
  39.           I will advise you  about further developments. Furthermore  you
  40.           will have  the right  to order  later versions  for only  a few
  41.           dollars and I will be willing to listen to your wishes.
  42.                And if you  don't like the system?   Well, throw  it away.
  43.           But you will like shareware, because it does not  let you pay a
  44.           lot of money for something you dislike afterwards.
  45.                Whether you  register or  not, you are  encouraged to pass
  46.           this  system  around.    Give  away  copies  to  your  friends.
  47.           However, files  with the  extension .NAR  should  not be  given
  48.           away.    The  copies  you pass  around  must  be  complete  and
  49.           unmodified,  but file-compression  is allowed.   Any  money you
  50.           collect  should  be for  diskette,  packing,  postage only  and
  51.           should not exceed five dollars.
  52.            
  53.           ABOUT THE AUTHOR
  54.  
  55.                I have  been working  with computers since  1970.  I  have
  56.           completed  a third-level  degree in  computer-science.   I have
  57.           been employed for many years in a  big company, making defense-
  58.           equipment,  and my  colleagues considered  me the  most skilled
  59.           programmer among  them.  However, since  the company went broke
  60.           (Gorbachev  was to  blame, and  he  did a  good  job) I  became
  61.           unemployed and started woring as a shareware author.
  62.  
  63.  
  64.  
  65.           *******************************
  66.           *       D I S A S T E R       *
  67.           *******************************
  68.  
  69.  
  70.             Disaster is an interactive disassembler for the IBM-PC.
  71.  
  72.             A  disassembler is not something special.  The program DEBUG,
  73.           which is  part of  MSDOS, contains a  disassembler.  But  DEBUG
  74.           knows only  the 8086 and 8088.   Furthermore DEBUG  produces no
  75.           coding which cab be used as input to an assembler.
  76.  
  77.             No disassembler  produces a neat assembly-language program at
  78.           once.   In stead,  disassembling a program  takes many days  of
  79.           labor.
  80.  
  81.             The simplest conceivable disassembler  works straightforward.
  82.           It   reads   the   machine-language   program   and  translates
  83.           everything  into assembly-language,  no  matter whether  it  is
  84.           code or data.
  85.            
  86.             Disaster works interactively.   You can inspect the  program,
  87.           add labels  and comments,  indicate what  is code  and what  is
  88.           data.   The result can  be saved so you  can continue  the next
  89.           day.    Eventually  DISASTER  makes  a  neat  assembly-language
  90.           program.
  91.  
  92.             This  manual  is  very  short.   There  is  little  to  tell.
  93.           Knowledge of the PC and its assembly-language is presumed.
  94.  
  95.             DEMONSTRATION
  96.  
  97.  
  98.             The first time DISASTER is started with the DOS command:
  99.                     DISASTER
  100.             You  will see an  error message  which you  can ignore.   The
  101.           prompt --> indicates that DISASTER expects your commands.
  102.  
  103.             Now read a program with the command:
  104.                     R name.EXE          
  105.           or:
  106.                     R name.COM
  107.           or:
  108.                     R name.SYS
  109.  
  110.             If you  want  to disassemble  something  that is  already  in
  111.           memory, then tou enter:
  112.                     R segment-address.ROM
  113.  
  114.             Now you  must tell  that the program  must be disassemble  as
  115.           code.  The command is (exactly this):
  116.                     C LSTARTLOCATION,I
  117.             That's  a long command, but LSTARTLOCATION  is simply a label
  118.           in your program.
  119.             Now start disassembling!  Enter the command: 
  120.                     U LSTARTLOCATION
  121.           and  you  will see  a  piece  of disassembled  program  on  the
  122.           screen.. To the  left you see the addresses, next  the mnemonic
  123.           codes,  and  to  the  right (in  color)  the  original  machine
  124.           language.   A green  block indicates that  no valid opcode  was
  125.           found. Prefixes  will be yellow, modrm-bytes and sib-bytes red,
  126.           other bytes green.
  127.  
  128.             Different U-commands are:
  129.                     U address        disassemble 20 line from ...
  130.                     U address,addressdisassemble from .. to ..
  131.                     U                disassemble next 20 lines
  132.                     <return>         same
  133.  
  134.             Addresses  in commands are always  hexadecimal.   In stead of
  135.           addresses you can enter labels (see below).
  136.  
  137.             LABELS
  138.  
  139.  
  140.             All adresses  will  be hexadecimal.    Of course  you  prefer
  141.           labels. That can be arranged with the command:
  142.                     L address,label
  143.  
  144.             As  usual in programming  languages, the  a label  must start
  145.           with a letter.  Furthermore  it must contain at least once  the
  146.           letter G thru Z.  The maximum length is fourteen characters.
  147.  
  148.             If  a label does  not contain  any of the  letters G  thru Z,
  149.           then DISASTER will assume it is a hexadecimal address.
  150.  
  151.             Be careful When  using labels which start with the  letter L.
  152.           The functie which generates controls assumes that such  a label
  153.           is followed by instruction-code staat.
  154.  
  155.             Labels may be  used in commands.  The U  commando could be: U
  156.           label,label.  
  157.  
  158.             Labels can be removed with the command:
  159.                     L label,-
  160.           or:
  161.                     L adress-
  162.  
  163.             Labels can be renamed with the command:
  164.                     L old name,new name
  165.  
  166.             Two labels cannot be at the same address.
  167.  
  168.             Het maximum number of labels is 4090.
  169.  
  170.             CONTROLs
  171.  
  172.  
  173.             Not everything  is  instruction-code.   There  is also  data.
  174.           The disassembler cannot tell  the difference.  And what's more,
  175.           there are  different kinds  of code  and data.   Therefore  you
  176.           must  tell DISASTER what is code and what is data and what kind
  177.           it is.  This is done with the command:
  178.                     C address,letter(s)
  179.           or:
  180.                     C label,letter(s)
  181.  
  182.             A control can be removed by:
  183.                     C address,-
  184.           or:
  185.                     C label,-
  186.  
  187.             Beyond  a  control   disassembling  is   controlled  by   the
  188.           letter(s). 
  189.  
  190.             That letter(s) can be:
  191.                     B hexadecimal bytes
  192.                     T text in quotes, when possible
  193.                     W hexadecimal words
  194.                     I instruction-code for Intel chips
  195.                     IV instruction-code for NEC V20 of V30
  196.                     IA instruction-code  for 80386 in protected mode with
  197.           addresslength of 32 bits.
  198.                     IO instruction-code for  80386 in protected mode with
  199.           operandlength of 32 bits.
  200.                     IAO combination of IA and IO.
  201.  
  202.             B, T and  W are data-controls, the others  are code-controls.
  203.           This distinction is important for the A- and  B-commando, which
  204.           will be discussed below.  
  205.             The controls  chop your  program into  sections.   There  are
  206.           data-sections and code-sections.
  207.  
  208.             If DISASTER encounters an opcode tegenkomt which is valid  on
  209.           a  NEC-chip  but not  on  a  Intel-chip, or  vice  versa,  then
  210.           DISASATER will just disassemble it.  Whether  I of IV was given
  211.           is  not  important.    But  there  are  opcodes  which  have  a
  212.           different meaning  on NEC- and Intel-chips.   In that case I or
  213.           IV decides what to do.  Program with these opcodes are rare.
  214.  
  215.             IA  and IO can only be used in programs which are intended to
  216.           run  on a  80386 in protected  mode.  In  real mode the address
  217.           and operand default to 16 bits.
  218.  
  219.             The maximum number of controls is 16380.
  220.  
  221.             INITIALLY ENTERED LABELS AND CONTROLS
  222.  
  223.             If you  read  a file,  DISASTER  will automatically  generate
  224.           some labels  and controls  in the  header.   Most labels  begin
  225.           with   the  letter   Z.     There  is   also   a  label   named
  226.           LSTARTLOCATION,  and   that  is  the  address  where  execution
  227.           starts. 
  228.             Without the  header the  initial control  is T.   That  seems
  229.           strange, it  is done because the  correct controls are  not yet
  230.           known, and to make it easy to recognize readbale text.
  231.  
  232.  
  233.  
  234.             AUTOMATIC LABEL GENERATION
  235.  
  236.             Manually entering labels and controls is a very  tedious job.
  237.           DISASTER can help you.
  238.  
  239.             Labels will be generated with the command:
  240.                     A address,address
  241.  
  242.             DISASTER now  searches your program, at the same time showing
  243.           a listing.   Only code-sections will be searched, data-sections
  244.           will be  skipped.   Each time  DISASTER encounters an  address-
  245.           reference a label will be entered.
  246.             This label will look like: L45A3_27E5.
  247.             The  first  letter  op  de   label  indicates  the  kind   of
  248.           reference: 
  249.                     L branch instruction
  250.                     W word data
  251.                     T byte data
  252.  
  253.             That  first letter  is followed  by the  hexadecimale address
  254.           the  label refers  to.   This guarantees  that  all labels  are
  255.           distinct.   It is  followed by  an underscore  and the  address
  256.           where the reference  was encountered for the first time.   This
  257.           facilitates surveying the program.
  258.  
  259.             Whenever a label  is generated DISASTER will show a  block on
  260.           the screen.   Therefore this block is  shown in every  JMP- and
  261.           every  CALL-instruction  and  in every  memory-reference  where
  262.           there was no label yet.
  263.  
  264.             AUTOMATIC CONTROL GENERATION
  265.  
  266.             Controls woll automaticaly be generated with the command
  267.                     B address,address
  268.  
  269.             DISASTER now searches  the labels of your program.   Whenever
  270.           DISASTER encounters  a  label in  a  data-section which  begins
  271.           with an  L, a  control I  will be generated,  causing the  next
  272.           part of  the program to  be interpreted as code.   At  the next
  273.           unconditional RET-  or JMP-instruction another control  will be
  274.           generated to restore the previous situation.
  275.  
  276.             Whenever a  control will be  generated DISASTER  will show  a
  277.           block on the screen.  Therefore this blok will be shown:
  278.             1 at every label that begins with an L and occurs  in a data-
  279.           section.
  280.             2 at the first RET- or JMP-instruction afterwards.
  281.  
  282.             Furthermore, whenever a  control I is generated, that  bit of
  283.           coding  will be  searched  for  address-references to  generate
  284.           labels (as described in the previous chapter).
  285.  
  286.             HINTS
  287.  
  288.              Usually a disassembly starts like this:
  289.  
  290.             C:\disaster              Start DISASTER 
  291.             --->Rprogr.com           read the program
  292.             --->B100,ffff            generate labels and controls
  293.             --->B100,ffff
  294.             --->B100,ffff
  295.             --->B100,ffff
  296.  
  297.             You  will see  that  more and  more labels  and code-controls
  298.           will appear.
  299.  
  300.             The command  B100,ffff can  easily be  repeated with the  F3-
  301.           key. Repeat it  until DISASTER reports that no more  labels and
  302.           controls were added.
  303.  
  304.             If you are  lucky this has almost completed  disassembly, and
  305.           you hardly did anything!  How many  other disassemblers will do
  306.           that for you?
  307.  
  308.             Is there nothing  to go wrong?  Alas, nothing is perfect, for
  309.           example in these cases:
  310.           0150      JNZ L0123
  311.           0152      JZ  L0156
  312.           0154      ADD B[BX+SI],AL
  313.             The B-command  thinks that the  instruction at 0154 is  code,
  314.           since it is not preceded by a unconditional jump.   But JNZ and
  315.           JZ taken  together are unconditional, and the instructions from
  316.           0154 and further  should be data.   If there are, beyond  0154,
  317.           things  which look  like instructions  with address-references,
  318.           then there will be false labels.
  319.             If you look  well while the B-command is executing,  then you
  320.           will see  this happen.   Interrupt  the command  with any  key,
  321.           search for the  right spot and enter a data-control  at address
  322.           0154.
  323.  
  324.                     INT 020
  325.             This  is the end of the program, just like INT 021 with AH=00
  326.           or 04C.  The B-command does not recognize it
  327.  
  328.                     JMP [08170+BX]
  329.             This  is  a  branch  through  a  table  of  branch-addresses.
  330.           DISASTER does not  recognize this.  You must give labels to the
  331.           addresses  in the  table.   Use  labels  which begin  with  the
  332.           letter L, so the B-command will treat it as code. 
  333.  
  334.             COMMENTS
  335.  
  336.             You can enter comments with the command:
  337.                     ;address,text
  338.           or, of course:
  339.                     ;label,text
  340.  
  341.             Note  the  semicolon which  is  the first  character  of this
  342.           command.
  343.  
  344.             Comments can be removed with:
  345.                     ;address,-
  346.           or:
  347.                     ;label,-
  348.  
  349.             De maximum length of a comment is 127 bytes.
  350.  
  351.             There can be no two comments on one address.
  352.  
  353.             De  maximum amount  of commentaar is  about 62500 bytes, plus
  354.           some overhead.
  355.  
  356.             Of course you will prefer to replace  the generated labels by
  357.           others which have a clearer meaning.
  358.  
  359.  
  360.  
  361.             MAKING A SOURCE-FILE
  362.  
  363.  
  364.             Eventually you'll  want  to  produce  a  source-file.    This
  365.           source-file can  be  re-assembled with  an  assembler, such  as
  366.           Eric  Isaacson's  A86.   The  source-file  is opened  with  the
  367.           command:
  368.                     W
  369.             The source-file  has the  same name  as the  .SYS-, .EXE-  or
  370.           .COM-file, but the extension is .8.
  371.  
  372.             As lon  as the source-file  is open the prompt  is >>>.   The
  373.           only legal commands now are U and Q.
  374.  
  375.             After the  command W you will  enter one or  more U-commands.
  376.           You  will   only  see   the  addresses   on  the   screen,  the
  377.           disassembled text goes to the file.
  378.  
  379.             Eventually close the file with the command:
  380.                     Q
  381.           This redisplays the prompt -->.
  382.  
  383.             Perhaps  you expect  that assembling  the  source-file should
  384.           produce  the same  .COM-  of .EXE-file  again.   Actually  many
  385.           machine instructions have the same mnemonic code, such as:
  386.             MOV AX,BX                8BC3 of 89D8
  387.             REP MOVSB                F3A4 of F2A4
  388.             ADD BX,5                 83C305 of 81C30500
  389.             JMP $+8                  EB06 of E90500
  390.  
  391.             Furthermore  some   instrctions  are   conceivable  but   not
  392.           acceptable to the processor, such as SHL  AL,30 of BOUND AX,BX.
  393.           DISASTER accepts these, the assembler may refuse them.
  394.  
  395.  
  396.  
  397.             HELP
  398.  
  399.             Help-texts are available  with the keys F5 thru  F10.  F1 and
  400.           F3 remain available to repeat commands.
  401.             Any key removes the help-text.
  402.  
  403.  
  404.  
  405.             INTERRUPTING AND CONTINUING
  406.  
  407.  
  408.             You  have worked some time and  entered many labels, controls
  409.           and comments.  You  want to go on  the next day.  This  is done
  410.           with the command:
  411.                     S
  412.             DISASTER  now writes  a script-ile.   This file  has extensie
  413.           .SCR and, unless you  gave another name, the same name  as your
  414.           program.
  415.  
  416.             If the script-file exists, DISASTER will ask you to confirm.
  417.  
  418.             Eventually stop with the command:
  419.                     Q
  420.             When no script-file  has been made. DISASTER will ask  you to
  421.           confirm.
  422.  
  423.             To  continue  the next  day start  the disassembler  with the
  424.           command:
  425.                     DISASTER filename
  426.           entering the  name of the script-file waarbij  u de naam van de
  427.           scriptfile opgeeft.
  428.  
  429.             A  script-file is  an ASCII-file  containig commands  for the
  430.           disassembler.   Feel  free to  modify this  file  with a  text-
  431.           editor. 
  432.